package com.zyg.order.controller;

import com.zyg.common.utils.R;
import com.zyg.order.service.TbOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ------------------------------
 * 功能：
 * 作者：WF
 * 微信：hbxfwf13590332912
 * 创建时间：2021/11/12-15:15
 * ------------------------------
 */
@RestController
@RefreshScope
public class MyConfigController {
    @Value("${base.user.name}")
    private String name;
    @Value("${base.user.age}")
    private int age;

    @Autowired
    private TbOrderService orderService;

    @RequestMapping("info")
    public R info(){
        return R.ok().put("name",name).put("age",age);
    }

    @GetMapping("/order/list")
    public R list(){
        return R.ok().put("list",orderService.list());
    }
}
